#include <stdio.h>

int main(int argc, char *argv[])
{
    int e;
    int n = 0, p = 0, cols = 16, octspergrp = 2;
    char hexxa[] = "0123456789abcdef", *hexx = hexxa;
    FILE *fp = fopen(argv[1],"r");
    while((e = getc(fp)) != EOF) {
        int x;
        if(p%16 == 0) printf("%08lx: ",(unsigned long)n);
        printf("%c%c",hexx[(e>>4) & 0xf],hexx[e & 0xf]);
        if(p%2 == 1) printf(" ");
        n++;
        if (++p == cols) {
            printf("\n");
            p = 0;
        }
    }
}